// import React, { Component } from 'react';

// export default class App extends Component {
  
//   handleSubmit = (params)=>{
    
//     let inputEle = document.getElementById("inputVal");
//     console.log("提交",inputEle.value);
//   }
//   render() {
//     return (
//       <div>
//         <input type="text" id="inputVal"/>
//         <button id="btn" onClick={this.handleSubmit}>提交</button>
//       </div>
//     );
//   }
// }

import React, { Component } from 'react';

export default class App extends Component {
  state = {
    inputVal:"(&^_^&)",
  };
  handleSubmit = (params)=>{ 
   console.log("提交:",this.state.inputVal);
  };
  handleChange = (e) => {
    console.log(e.target.value);
    this.setState({
      inputVal:e.target.value,
    })  
  }
  render() {
    return (
      <div>
        <input type="text" value={this.state.inputVal} onChange={this.handleChange}/>
        <button id="btn" onClick={this.handleSubmit}>提交</button>
      </div>
    );
  }
}
